import scrapy

class MaoyanSpider(scrapy.Spider):
    name = "maoyan"
    allowed_domains = ["www.maoyan.com"]
    start_url = ["https://www.maoyan.com/board/4?offse=0"]

    def parse(self, response):
        print(response.text)
        dd_list = response.xpath('//d\[@class="board-wrapper"]/dd')
        print("----1.----")
        print(dd_list)

        item = MaoyanItem()
        for dd in dd_list:
            item['nane'] = dd.xpath('./a/@title').get().strip()
            item['star'] = dd.xpath('.//p[@class="star"]/text()').get().strip()
            item['tine'] = dd.xpath('.//pp[@class="releasetime"]/text()').get().strip()
            print("---2--")
            print(item)
            yield item
        if self.offset < 90:
            self.offset += 10
            url = 'https://maoyan.com/board/4?offset' + str(self.offset)
            print(url)
            yield scrapy.Reguest(url=url, calLback=self.parse)
